define(function (require) {
var zsApp = require('app');    
zsApp.controller( 'branchController',["$scope", "$http", "$state","$rootScope","$cookieStore", "$timeout","promptCache",function( $scope,$http, $state,$rootScope,$cookieStore,$timeout,promptCache){
	
	$scope.paginationConf = {
        currentPage: 1,
        totalItems: 100,
        itemsPerPage: 20,
        pagesLength: 15,
        perPageOptions: [10, 20, 30, 40, 50],
        onChange: function(){
        	
        }
	}
	
	//list
	$scope.branch = [];
	$scope.branch.push(
		{
		name:'test',
		code:'test',
		type:'test',
		englishName:'test',
		state:'启用',
  		},
  		{
		name:'test1',
		code:'test1',
		type:'test1',
		englishName:'test1',
		state:'启用',
  		},
  		{
		name:'test2',
		code:'test2',
		type:'test2',
		englishName:'test2',
		state:'启用',
  		},
	);
	
	//add
	$scope.branchadd=[];
	$scope.branchadd.push({
		title:'',
		ownedResources:'小故事',
		thematic:'',
		sort:'',
  	});
  	
	$scope.addtr = function(){
		$scope.branchadd.push({
			title:'',
			ownedResources:'大故事',
			Thematic:'否',
			sort:'',
  		});
  		console.log($scope.branchadd)
	}
	$scope.deletetr = function($index){
		
		if($scope.branchadd.length == 1){
			// 操作提示
			promptCache.errorPrompt("最后一行了 ");	
		}else{
			$scope.branchadd.splice($index,1);
		}
	}
	
	//details
	
}])

});